package com.example.demo.entity.life;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

/**
 * @Author : 叶荻风
 * @create : 2024/5/21 10:31
 */
public class Product implements InitializingBean, DisposableBean {
    private String name;
    public Product() {
        System.out.println("product create");
    }

    //spring会进行调用
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet");
    }
    public void myInit(){
        System.out.println("myInit");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        System.out.println("setName");
        this.name = name;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy");
    }

    public void myDestroy() {
        System.out.println("MyDestroy");
    }
}
